﻿<div>

<h2>JavaScript 代码：</h2>
<textarea name="dp-syntaxhighlighter" class="brush: js; highlight: [16,17,18,19,20,21,22,23]" >
    
    $(function () {
        $("#tree").tree({
            method: "get",
            lines: true,
            url: "tree/tree-data.json",
            autoBindDblClick: false,
            enableContextMenu: true,
            contextMenu: [
                { text: "测试菜单1", iconCls: "icon-hamburg-address", disabled: false, handler: function () { alert("您点击了测试菜单1"); } },
                { text: "测试菜单2", children: [
                    { text: "测试子菜单1", handler: function () { alert("aaa"); } },
                    { text: "测试子菜单2", handler: function () { alert("bbb"); } }
                ]
                },
                "-",
                {
                    text: function (e, node) { return "当前节点文本为：" + node.text; },
                    iconCls: function () { return "icon-hamburg-pencil"; },
                    disabled: function () { return false; },
                    handler: function (e, node, tree) {
                        alert("当前树控件的根节点一共有 " + tree.tree("getRoots").length + " 行数据");
                    }
                }
            ]
        });
    });

</textarea>
<h2>HTML 代码：</h2>
<textarea name="dp-syntaxhighlighter" class="brush: html; highlight: []" >
    
    <ul id="tree"></ul>

</textarea>


</div>